/*
Matthew Graham	
Proposal title: "A Conditional Commitment? Partisan Identity and Support for Democracy"

HYPOTHESES

Stated-Hyp1: Partisan identity has an effect on Americans' support for democracy (p. 2/3) 
	NOTE: hypothesis is not explicitly stated but implied by the pilot results
	that consitute the proposal.

	Test-Hyp1: Support for undemocratic candidates will be higher in party prime condition vs. control condition


********************************************************************************
NOTES:

- There is no well-defined hypothesis in this proposal. The proposal mainly described their pilot experiment, which differs from the experiment they actually fielded. We therefore test for differences in outcome by treatment status. 

Issue #1 and how resolved:
	- The experiment has 3 rounds. In each round, respondents see three split 
	frames (with a democratic and undemocratic candidate) and then stated which
	candidate they preferred (preference for the undemoractic candidate is the DV). 
	In order to know who the respondents preferred, we need to know whether the
	names selected by the candidates belonged to the democratic or undemocratic 
	candidate. There is no way of knowing that with the given data alone. 
	Specifically, the response is in the form of: Name 1/Name 2. But the variable 
	that identifies which candidate profile the respondents' saw does not always 
	include the name variable (see variables UNDEMOC1, UNDEMOC2, UNDEMOC3, DEMOC1, 
	DEMOC2, DEMOC3). It seems from these variables that:
	Round 1: undemoc candidate name is 1
	Round 2: undemoc candidate name is 3 or 4 [seems like a randomization error]
	Round 3: undemoc candidate name is 5 or 6 [seems like a randomization error]
	Also note that for some of the profiles, we don't even know what name the 
	respondent saw. 

	- We corresponded with the author in April 2021. From email correspondence 
	with author:
		"The RND_ variables are coded 1 if candidate 1 is the anti-fairness 
		candidate and 0 if candidate 2 is the anti-fairness candidate."
		"...the variables RND_01 (corresponds to Q6), RND_02 (Q7), RND_03 
		(Q8). These variables are coded 1 if candidate 1 is the anti-
		fairness/bad candidate and 0 if candidate 1 is the pro-fairness/
		good candidate."

Issue #2 and how resolved:
	- The proposal suggests (although hypotheses are never stated) that the party of 
	the other candidate matters (i.e. parties of both candidates were varied). In the 
	fielded quex however, all candidates are co-partisan (see quex, page 16).

Issue #3:
	- The proposal mentions plans to examine independent respondents 
	as well (page 6). However there are no independent respondents in the sample 
	(PARTYID7).
	
Issue #4: 
	- The proposal mentions that plans to examine hetrogeneity 
	and specifies all the core items as potential sources of heterogeniety. 
	Author also mentions requesting those items because of interest 
	due to "another strand" of their research. We are not pursuring hypotheses
	about heterogeneity. 
	
Issue #5:
	- The author mentioned in an email correspondence that they analyzed the data 
	by stacking it. We did not do that. 
	The proposal doesn't specify any analysis plan. 
	In other studies, we have added the responses in similar cases
	(i.e. cases where the treatment is not at the question level but rather
	precedes all 3 questions.)
	
*/


use "Graham1155.dta", clear

********************************************************************************

* INDICATORS OF EXPERIMENTAL MANIPULATIONS

	* partisan identity prime
		tab P_EXP
		recode P_EXP (1=1) (2=0), gen(treat_primed)
		tab treat_primed

	
* OUTCOME MEASURES

	* the first candidate is undemocratic
		// note: each R saw 3 questions.
			
	clonevar undemoc_candidate1 =RND_01 
	clonevar undemoc_candidate2 =RND_02
	clonevar undemoc_candidate3 =RND_03
	
	* was the first candidate chosen?
		/*
			"...the variables RND_01 (corresponds to Q6), RND_02 (Q7), RND_03 
		(Q8). These variables are coded 1 if candidate 1 is the anti-
		fairness/bad candidate and 0 if candidate 1 is the pro-fairness/
		good candidate."
		*/
	
	recode Q6 (1=1) (2=0) (98=.), gen(firstchosen1)
	recode Q7 (1=1) (2=0) (98=.), gen(firstchosen2) 	
	recode Q8 (1=1) (2=0) (98=.), gen(firstchosen3)	
	
	* was the undemocratic candidate chosen? 
	forval i=1/3 {
		gen choseundemoc`i'=.
		replace choseundemoc`i'=1 if firstchosen`i'==1 & undemoc_candidate`i'==1
		replace choseundemoc`i'=1 if firstchosen`i'==0 & undemoc_candidate`i'==0

		replace choseundemoc`i'=0 if firstchosen`i'==1 & undemoc_candidate`i'==0
		replace choseundemoc`i'=0 if firstchosen`i'==0 & undemoc_candidate`i'==1
	
	tab choseundemoc`i', mis	
	}
	
	* total number of undemocratic candidates chosen
	gen totalundemoc= choseundemoc1 + choseundemoc2 + choseundemoc3
	tab totalundemoc
	
********************************************************************************

* ANALYSIS
	

*Test-Hyp1: Support for undemocratic candidates will be higher in party prime condition vs. control condition
	
	reg totalundemoc i.treat_primed
	// 0.535
	tess 1.treat_primed +, init(Graham1155)
